package fnord.network.calculator;

import java.util.*;

import fnord.illuminati.card.GroupCard;
import fnord.illuminati.card.IlluminatiCard;

public abstract class Calculator {
	
	public void traverse(IlluminatiCard ic) {
		//TODO: implement BFS and call calculate on each card in the tree
		Queue<GroupCard> bfsQueue = new LinkedList<GroupCard>();
		bfsQueue.add(ic);
		while(!bfsQueue.isEmpty()) {
			GroupCard popped = bfsQueue.remove();
			calculate(popped);
			for(GroupCard c : popped.getChildren()) {
				if(c != null)
					bfsQueue.add(c);
			}
		}
	}
	
	public abstract void calculate(GroupCard toCalculateOn);
}
